import requests

agentUrl = 'https://movie.douban.com/j/chart/top_list'
# get请求参数可以单独封装到一个字典里
param = {
    "type": "24",
    "interval_id": "100:90",
    "action": "",
    "start": 0,
    "limit": 2
}
header = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36"
}
resp = requests.get(url=agentUrl, params=param, headers=header)
# print(resp.request.url)
#
# print(resp.request.headers)  # 查看请求时候都user属性
print('返回值:', resp.json())

# 关闭链接
resp.close()